package cn.edu.lzu.dao;

import cn.edu.lzu.entity.ExamineItem;
import cn.edu.lzu.entity.ExaminePackage;
import cn.edu.lzu.entity.ItemPackage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @PackageName: cn.edu.lzu.dao
 * @InterfaceName: ItemPackageMapper
 * @Description: TODO 对项目套餐关联关系表的操作
 * @Author: 张琦[QQ:3098086691]
 * @Date: 2020/1/16 21:29
 * @Version: 1.0
 */
@Mapper
public interface ItemPackageMapper {
    @Insert("insert into item_package (examine_item_id, examine_package_id, examine_type, unit_id, is_deleted) values (#{examineItemId}, #{examinePackageId}, #{examineType}, #{unitId}, 0)")
    int insItemPackage(int examineItemId, int examinePackageId, long unitId, String examineType);

    @Select("select * from item_package where examine_package_id = #{examinePackageId} and examine_type=#{examineType} and is_deleted=0")
    List<ItemPackage> selItemPackagesByPackageId(int examinePackageId, String examineType);

    @Update("update item_package set is_deleted=1 where examine_package_id=#{examinePackageId} and unit_id=#{unitId}")
    int updDeleteByPackageId(int examinePackageId, long unitId);

    @Update("update item_package set is_deleted=1 where examine_package_id in (${examinePackageIds}) and unit_id=#{unitId}")
    int updBatchDeleteByPackageId(String examinePackageIds, long unitId);


}
